-
-
Notifications
You must be signed in to change notification settings - Fork 358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement --output={null,pipe,<FILE>} #509
Conversation
TLDR: The new BenchmarksThe first benchmark is
|
Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
---|---|---|---|---|
cat large |
166.9 ± 2.0 | 160.6 | 168.7 | 1.00 |
cat large >/dev/null |
167.5 ± 1.2 | 165.4 | 169.5 | 1.00 ± 0.01 |
cat large | cat >/dev/null |
492.8 ± 14.5 | 468.6 | 511.9 | 2.95 ± 0.09 |
cat large | pv -q >/dev/null |
347.2 ± 14.9 | 323.0 | 363.6 | 2.08 ± 0.09 |
--output=pipe
cat large
is within 2-3% of | pv -q >/dev/null
, which makes sense as both are using splice()
.
These methods are about 40% faster than | cat >/dev/null
, which uses read()/write()
through a pipe.
Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
---|---|---|---|---|
cat large |
357.1 ± 4.4 | 348.8 | 363.5 | 2.13 ± 0.03 |
cat large >/dev/null |
167.8 ± 1.4 | 165.6 | 170.9 | 1.00 |
cat large | cat >/dev/null |
474.3 ± 15.9 | 458.0 | 510.9 | 2.83 ± 0.10 |
cat large | pv -q >/dev/null |
348.2 ± 9.3 | 335.9 | 363.0 | 2.08 ± 0.06 |
--output=/tmp/file
Writing to tmpfs is ~10% faster than writing to /dev/null
through a pipe! But slower than splice()
, which makes sense.
Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
---|---|---|---|---|
cat large |
436.0 ± 2.2 | 433.1 | 439.6 | 2.61 ± 0.03 |
cat large >/dev/null |
166.9 ± 1.7 | 162.5 | 169.5 | 1.00 |
cat large | cat >/dev/null |
475.5 ± 20.2 | 445.8 | 504.4 | 2.85 ± 0.12 |
cat large | pv -q >/dev/null |
364.2 ± 24.2 | 319.6 | 399.8 | 2.18 ± 0.15 |
This is awesome - thank you very much! Also for the benchmarks which clearly show that this is working correctly. I have a couple of questions before I proceed with the review:
|
You're welcome!
Yeah I think that makes sense for consistency. Maybe I also think we should eventually add Which reminds me, I think
I don't see the benefit of a separate |
Good point. I like
I remember that comment. Yes, absolutely agreed.
👍 I was thinking about this edge case ("what if a user wants to print to a file called
Okay. |
Done.
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Fixes #377.